/**
 * Created by kaki on 2017/9/21.
 */
import fetch from 'utils/fetch';
// strategy 可选banner / avatar
export function upLoad(data, strategy = 'avatar') {
  return fetch({
    url: `/api/files/upload?strategy=${strategy}`,
    method: 'post',
    data,
  });
}

// 查询一条会员卡信息
export const Show = (id) => {
  return fetch({
    url: `/api/staff/cards/${id}?include=saleman,coach,avatar`,
    method: 'get',
  })
}

// 额外信息
export const extraInfo = () => {
  return fetch({
    url: `/api/staff/cards/extra-info`,
    method: 'get',
  })
}

// 更新一条会员卡信息
export const Update = (id, data) => {
  return fetch({
    url: `/api/staff/cards/${id}`,
    method: 'put',
    params: data
  })
}

// 查询一条用户信息
export const ShowUser = (id) => {
  return fetch({
    url: `/api/staff/users/profiles/${id}?include=user,avatar`,
    method: 'get',
  })
}

// 添加会员卡
export const CreateCard = (data) => {
  return fetch({
    url: '/api/staff/cards',
    method: 'post',
    data
  })
}

// 删除会员
export const Delete = (id) => {
  return fetch({
    url: `/api/staff/cards/${id}`,
    method: 'delete'
  })
}

export const GetAllCardType = () => {
  return fetch({
    url: `/api/staff/cards/types`,
    method: 'get'
  })
}
